
local fps = class.text.create('',(1920-200)/2,100,200,30,12,5)

fps.time = 0
fps.count = 0
fps.fps = 0
function fps:update(frame)
    self.time = self.time + frame
    if self.time>=0.5 then
        local lua = (collectgarbage("count") / 1024)
        local vm = japi.GetUsedMemory2()
        local str = ("fps:%s lua:%s vn:%s"):format(
            math.floor(self.fps/self.count),
            math.floor(lua),
            math.floor(japi.GetUsedMemory2())
        )
        self.time = self.time - 1
        self.count = 0
        self.fps = 0
        self:set_text(str)
    else
        self.count = self.count + 1
        self.fps = self.fps + japi.GetFps()
    end
end



ac.game:notify('游戏-注册显示UI',fps)